#!/bin/sh
## Wrapper to portably run makedepend or equivalent compiler built-in.
## Runs on Makefile.in, generates Makefile
## {- join("\n## ", @autowarntext) -}

{- "MAKEDEPEND=" . quotify1($config{makedepprog}) -}

case "${MAKEDEPEND}" in
cat)
    ;;
makedepend)
    ${MAKEDEPEND} $@ || exit 1
    ;;
*)
    args="-Werror -MM"
    while [ $# -gt 0 ]; do
        if [ "$1" != '--' ] ; then
            args="$args $1"
        fi
        shift
    done
    sed -e '/DO NOT DELETE THIS LINE/q' Makefile >Makefile.tmp
    ${MAKEDEPEND} $args >>Makefile.tmp || exit 1
    mv Makefile.tmp Makefile
    ;;
esac
